package com.yanqu.road.entity.activity.foxcard.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_fox_shop")
public class FoxCardShopConfig {
    @FieldTypeAnnotation(select = true, orderASC = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "商店id", isIndex = true)
    private int id;
    @FieldTypeAnnotation(desc = "位置")
    private int position;
    @FieldTypeAnnotation(desc = "类型")
    private int cardType;
    @FieldTypeAnnotation(desc = "概率")
    private int weight;
    @FieldTypeAnnotation(desc = "价值金币")
    private int gold;
    @FieldTypeAnnotation(desc = "参数(总数|可选数量)")
    private String param;
    @FieldTypeAnnotation(desc = "名称")
    private String name;
    @FieldTypeAnnotation(desc = "描述")
    private String desc;
    @FieldTypeAnnotation(desc = "刷新回合")
    private int refresh;

    private List<Integer> paramList = new ArrayList<>();

    public FoxCardShopConfig(ResultSet rs) throws SQLException {
        this.activityId = rs.getInt("activityId");
        this.id = rs.getInt("id");
        this.position = rs.getInt("position");
        this.cardType = rs.getInt("cardType");
        this.weight = rs.getInt("weight");
        this.gold = rs.getInt("gold");
        this.param = rs.getString("param");
        this.name = rs.getString("name");
        this.desc = rs.getString("desc");
        this.refresh = rs.getInt("refresh");

        this.paramList = StringUtils.stringToIntegerList(param, "\\|");
    }

    public int getActivityId() {
        return activityId;
    }

    public int getId() {
        return id;
    }

    public int getPosition() {
        return position;
    }

    public int getCardType() {
        return cardType;
    }

    public int getWeight() {
        return weight;
    }

    public int getGold() {
        return gold;
    }

    public String getParam() {
        return param;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    public int getRefresh() {
        return refresh;
    }

    public List<Integer> getParamList() {
        return paramList;
    }
}